package cn.sinata.wanglin.neighbor.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import com.xilada.xldutils.activitys.TitleActivity;
import com.xilada.xldutils.utils.ActivityUtil;

import butterknife.BindView;
import cn.sinata.wanglin.R;

public class CreateGroupChatStepOneActivity extends TitleActivity {

    private String name;
    @BindView(R.id.et_name)
    EditText et_name;

    @Override
    protected int setContentId() {
        return R.layout.activity_create_group_chat_step_one;
    }

    @Override
    protected void initView() {
        super.initView();
        setTitle("填写群名称");
        addRightButton("下一步", new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                name = et_name.getText().toString().trim();
                if (TextUtils.isEmpty(name)) {
                    showToast("群名称不能为空");
                    return;
                }
                ActivityUtil.create(mContext)
                        .go(CreateGroupChatStepTwoActivity.class)
                        .put("name",name)
                        .startForResult(0);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            if (requestCode == 0) {
                setResult(RESULT_OK);
                finish();
            }
        }
    }
}
